package com.hzit.cart.controller;

import com.hzit.cart.api.domain.PayLog;
import com.hzit.cart.service.IPayLogService;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@RestController
public class PayLogController {

	@Autowired
	private IPayLogService payLogService;
	//1. 保存支付日志
	@PostMapping("/payLog/save")
	public R savePayLog(@RequestBody PayLog payLog){
		payLogService.save(payLog);
		return R.ok();
	}
	//2. 根据订单号查询支付日志
	@GetMapping("/payLog/{out_trade_no}")
	public R<PayLog> findPayLog(@PathVariable("out_trade_no") String out_trade_no){
		PayLog payLog = payLogService.getById(out_trade_no);
		return R.ok(payLog);
	}
	//3. 修改支付日志
	@PostMapping("/payLog/update")
	public R updatePayLog(@RequestBody PayLog payLog){
		payLogService.updateById(payLog);
		return R.ok();
	}
}
